<template>
  <!--修改角色-->
  <el-dialog
      title="提醒"
      :visible.sync="isShowDeleteRole"
      width="40%"
      :before-close="onClose"
      :close-on-click-modal="false"
  >

    <h2 style="text-align: center">是否删除<span style="color: red">  {{RoleInfo.roleName}} </span> 角色</h2>


    <span slot="footer" class="dialog-footer">
    <el-button @click="onClose">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
  </el-dialog>


</template>

<script>
import {deleteRole} from "@/network/system/role";

export default {
  name: "deleteRole",
  data() {
    return {

    }
  }, props: {
    isShowDeleteRole: {
      type: Boolean,
      default: false
    },
    RoleInfo:{
      type:Object,
      default: () => {{}}
    }
  },
  created() {
  }, methods: {
    /*关闭窗口*/
    onClose() {

      this.$emit('update:visible', false)
    },
    /*提交*/
    submit() {
      deleteRole(this.RoleInfo.id).then((res) => {
        if (res.code===200){
          this.$message({
            showClose: true,
            message: '删除角色 '+this.RoleInfo.roleName +'成功',
            type: 'success'
          });

          //更新角色列表
          this.$emit("updateRoleList")

        }else {
          this.$message({
            showClose: true,
            message: '删除角色 '+this.RoleInfo.roleName +'失败',
            type: 'error'
          });
        }
      })

        this.onClose()
    }

  }

}
</script>

<style scoped>

</style>